{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "dc960844",
   "metadata": {},
   "source": [
    "# 元组（tuple）\n",
    "* 【元组】（https://docs.python.org/3/tutorial/datastructures.html#dictionaries）  5.3 Tuples and Sequences\n",
    "  - 1.它是和 list 几乎完全一样的序列数据\n",
    "  - 2.它和 list 不同的地方是， **不可变** （因为不可变，所以几乎没有办法）\n",
    "  - 3.元组的形式： （1,2,3,4,5）对比 元组() 列表[]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "1807d172",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-25T03:38:43.788158Z",
     "start_time": "2021-10-25T03:38:43.770155Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('CC', 'VV')\n"
     ]
    }
   ],
   "source": [
    "names = \"CC\",\"VV\"\n",
    "print(names)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "614a16d0",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-25T03:35:07.828108Z",
     "start_time": "2021-10-25T03:35:07.815107Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tuple"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(names)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "799216d9",
   "metadata": {},
   "source": [
    "# 字典（dict）\n",
    "- 1. 字典的创建方式\n",
    "- 2.字典的性质"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "157f31e8",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-25T03:55:43.009512Z",
     "start_time": "2021-10-25T03:55:42.989940Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'stu01': 'AA', 'stu02': 'BB', 'stu03': 'CC'}\n",
      "{'stu01': 'DD', 'stu02': 'EE', 'stu03': 'FF'}\n",
      "{'stu01': 'GG', 'stu02': 'HH', 'stu03': 'II'}\n"
     ]
    }
   ],
   "source": [
    "# 字典的创建方式\n",
    "# 1.直接创建字典，结构：{key1:value1 , key2:value2,..... }\n",
    "stu_info = {\n",
    "    \"stu01\":\"AA\",\n",
    "    \"stu02\":\"BB\",\n",
    "    \"stu03\":\"CC\"\n",
    "}\n",
    "\n",
    "stu01 = {\n",
    "    \"name\":\"AA\",\n",
    "    \"age\":\"18\"\n",
    "}\n",
    "print(stu_info)\n",
    "\n",
    "\n",
    "# 2,dict()创建字典，dict(key1=value1 , key2=value2,.....)\n",
    "stu_info_02 = dict(\n",
    "    stu01=\"DD\",\n",
    "    stu02=\"EE\",\n",
    "    stu03=\"FF\"\n",
    ")\n",
    "print(stu_info_02)\n",
    "\n",
    "\n",
    "# 1和2 的区别：\n",
    "# 1. dict()  vs    {}\n",
    "# 2. stuoq   vs  \"stu01\"\n",
    "# 3. =       vs   :\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "# 3.新建空字典，运用增加值的方式创建字典\n",
    "stu_info_03 = {}\n",
    "stu_info_03['stu01'] = \"GG\"   # 字典的添加\n",
    "stu_info_03['stu02'] = \"HH\"\n",
    "stu_info_03['stu03'] = \"II\"\n",
    "print(stu_info_03)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "789dd12e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
